home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / fractal / kaos.lha / bin / kar < prev    next >
Encoding:
Text File  |  1990-02-06  |  5.2 KB  |  203 lines

  1. #!/bin/csh
  2. ###################################################################
  3. #        kaos tar archive script
  4. ###################################################################
  5. #
  6. # Tar a part or all of kaos files  onto a file:    kar [-s] [-i]
  7. # Copy a part or all of kaos files to a directory:   kar -c
  8. # Do the above updating c flow files:   kar [-c] -f
  9. #
  10. # The environmental variables $KAOSHOME and $AUTOHOME 
  11. # should be set in .login and .cshrc before executing this program
  12.  
  13. #
  14. # set the modes
  15. #
  16. # CHECK if KAOSHOME and AUTOHOME are defined !!.
  17. #
  18.  
  19. set arg =
  20. set copy =
  21. set flow =
  22.  
  23. foreach arg ($argv)
  24.     switch($arg)
  25.         case -c*:
  26.             set copy = on
  27.             breaksw
  28.         case -f*:
  29.             set flow = on
  30.             breaksw
  31.         case -s*:
  32.             set copy =
  33.             breaksw
  34.         default:
  35.             breaksw
  36.     endsw
  37. end
  38.  
  39. if ($copy != 'on') then
  40.     echo -n "Enter a tar file name: "
  41.     set tarfile = $< 
  42.     echo "Saving a part or all of kaos files onto $tarfile ..."
  43. else
  44.     echo -n "Enter directory to copy kaos from: "
  45.     set fromdir = $< 
  46.     echo -n "Enter directory to copy kaos to: "
  47.     set todir = $< 
  48.     if ( -d $fromdir) then
  49.         if (-d $todir) then
  50.             echo "Copying kaos files in directory $fromdir to directory $todir ..."
  51.         else
  52.             echo "$todir does not exists or is not a directory."
  53.         endif
  54.     else
  55.         echo "$fromdir does not exists or is not a directory."
  56.     endif    
  57. endif
  58.  
  59. #
  60. # absolute core files
  61. #
  62. set cfiles = (*.c *lib/*.c)
  63. set headers = (*.h include/*.h include/*.icon *lib/*.h)
  64. set colormaps = (cmaplib/*.128* userlib/*.128*)
  65. #  set makefiles = (Makefile *lib/Makefile colormap/Makefile)              #   mrm (2/6/90)
  66. set makefiles = (Makefile *lib/Makefile)
  67. #  set scripts = (installcap kaos_install ds_install modellib/kwrite_*)    #   mrm (2/6/90)
  68. set scripts = (installcap kaos_install dsclass_install modellib/kwrite_*)
  69. set binfiles = (bin)
  70. set helpfiles = (README* *lib/README* helplib/online_help*)
  71.  
  72. #
  73. # additional files
  74. #
  75. set autos = (${AUTOHOME}/AUTO86)
  76. set objs = (*.o *lib/*.o)
  77. set libs = (*lib/*.a)
  78. set bins = (kaos kaos_batch)
  79. set infos = (kaos.files kaos.lines kaos.cflow*)
  80. # temporary fix: get demonstartion files only from examples
  81. set examples = (examples/demo.*)
  82. set documents = (doc)
  83. set datafiles = (data)
  84. set psfiles = (PS)
  85. set rasfiles = (RAS)
  86. set archives = (archive)
  87.  
  88. start_over:
  89. #
  90. # groups
  91. #
  92. set group1 = ($cfiles $headers $colormaps $makefiles $scripts $helpfiles $binfiles)
  93. set group2 = (${group1} $examples)
  94. set group3 = (${group1} $examples $rasfiles)
  95. set group4 = (${group1} $documents $infos)
  96. set group5 = (${group1} $documents $infos $examples)
  97. set group6 = (${group1} $documents $infos $examples $psfiles $rasfiles)
  98. set group7 = (${group1} $objs $libs $bins)
  99. set group8 = (${group6}  $objs $libs $bins)
  100. set group9 = (${group6}  $objs $libs $bins)
  101. set group10 = (${autos})
  102. echo ""
  103. echo "Available options are:"
  104. echo "0: Interactive mode (Not installed yet)"
  105. echo "1: ABSOLUTE minimum copy of source files:"
  106. echo "2: Minimum + examples:"
  107. echo "3: Minimum + examples,rasters:"
  108. echo "4: Minimum + documents,info:"
  109. echo "5: Minimum + examples,documents,info"
  110. echo "6: Minimum + examples,documents,info,rasters,postscripts"
  111. echo "7: Minimum + objects,libraries,binaries"    
  112. echo "8: Minimum + examples,documents,info,rasters,postscripts"
  113. echo "             objects,libraries,binaries"    
  114. echo "9: Minimum + examples,documents,info,rasters,postscripts"
  115. echo "             objects,libraries,binaries,data,archive files"    
  116. echo "10: AUTO86"
  117. echo ""
  118. echo -n "Which one of the above options would you like to choose? Type number: "
  119. set answer = $<
  120. switch($answer)
  121.     case 0:
  122.         # echo start with kar -i for an interactive mode.
  123.         echo Not installed yet. Start over.
  124.         exit 0;
  125.         breaksw
  126.     case 1:
  127.         set group = ($group1)
  128.         breaksw
  129.     case 2:
  130.         set group = ($group2)
  131.         breaksw
  132.     case 3:
  133.         set group = ($group3)
  134.         breaksw
  135.     case 4:
  136.         set group = ($group4)
  137.         breaksw
  138.     case 5:
  139.         set group = ($group5)
  140.         breaksw
  141.     case 6:
  142.         set group = ($group6)
  143.         breaksw
  144.     case 7:
  145.         set group = ($group7)
  146.         breaksw
  147.     case 8:
  148.         set group = ($group8)
  149.         breaksw
  150.     default:
  151.         echo "Incorrect answer. Try again."
  152.         goto start_over
  153.         breaksw
  154. endsw
  155.  
  156. # generate flow tree in three different formats
  157.  
  158. switch($answer)
  159.     case [4-9]:
  160.         if ($flow == 'on') then
  161.             echo "Generating c source flow..."
  162.             cflow $cfiles > kaos.cflow.source
  163.             echo "Generating reversed source flow..."
  164.             cflow -r $cfiles > kaos.cflow.reversed
  165.             echo "Generating object flow..."
  166.             cflow $objs > kaos.cflow.object
  167.             echo "Generating a files with a size of kaos and its file organizagion..."
  168.             cat $group1 | wc > kaos.files
  169.             ls $group1 >> kaos.files
  170.         else
  171.             echo "Warning: C flow chart is not updated! Rerun with -f option to update."
  172.         endif
  173.         breaksw    
  174.     default:
  175.         if ($flow == 'on') then
  176.             echo "Updating c flow chart is not necessary fo this option."
  177.         endif
  178.         breaksw
  179. endsw
  180.  
  181. if ($copy != 'on') then
  182.     if ( -d ${KAOSHOME}) then
  183.         cd ${KAOSHOME}
  184.         tar cvf $tarfile $group
  185.     else
  186.         echo "${KAOSHOME} either is not a directory or does not exist. Exit."
  187.         exit -1
  188.     endif
  189.     echo ""
  190.     echo "Successfully saved kaos onto $tarfile."
  191.     echo ""
  192. else
  193.     if ( -d ${fromdir}) then
  194.         cd ${fromdir}; tar cf - $group | (cd $todir; tar xvfpB -)
  195.     else
  196.         echo "${fromdir} either is not a directory or does not exist. Exit."
  197.         exit -1
  198.     endif
  199.     echo ""
  200.     echo "Successfully saved kaos files in $fromdir onto $todir."
  201.     echo ""
  202. endif
  203.